home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / bbsutil / dlx70bbs.zip / DLX70SRC.ZIP / SCRIPT1.PAS < prev    next >
Pascal/Delphi Source File  |  1994-01-26  |  23KB  |  545 lines

  1. {$debug-}
  2. {$line-}
  3.  
  4. {$include: 'types.int'}
  5. {$include: 'globals.int'}
  6. {$include: 'ident.int'}
  7. {$include: 'utils.int'}
  8. {$include: 'fs_pkg.int'}
  9. {$include: 'database.int'}
  10. {$include: 'load.int'}
  11. {$include: 'sutils.int'}
  12. {$include: 'script1.int'}
  13.  
  14. IMPLEMENTATION OF script1;
  15.  
  16. USES types,globals,ident,utils,fs_pkg,database,load,sutils;
  17.  
  18. {DLX Bulletin Board System V7.0
  19.  
  20.  FREEWARE NOTICE
  21.  
  22.  DLX V7.0 is placed in the public domain by its author, Richard Gillmann.
  23.  Anyone who wishes to may run the program, copy it, or modify it for
  24.  any purpose, including commercial gain.}
  25.  
  26. {***INTERFACE TO THE COM_PAX2 ASYNCHRONOUS COMMUNICATIONS PACKAGE***}
  27. {$include: 'com_pax2.int'}
  28.  
  29. {***Interface to the assembler utilities packages***}
  30. {$include: 'pasasm.int'}
  31. {$include: 'newasm.int'}
  32.  
  33. procedure bbs1{consts s : lstring; var str : lstring};
  34. var
  35.   i,j : integer;
  36.   next_state : task;
  37.   p : para;
  38.   c : char;
  39.   fl : boolean;
  40.  
  41. begin
  42.   next_state:=succ(q[wx].state);
  43.   case q[wx].state of
  44.   main_menu: prompt_with(main_menu_txt);
  45.   main_fork:
  46.     [next_state:=main_menu;
  47.      if time_check(true) then
  48.        [display(time_limit_txt); next_state:=snip]
  49.      else if str=null then
  50.         display(dunno_txt)
  51.      else if str='VERSION' then {version}
  52.        [p:=newpara('DLX 7.00');
  53.         w^[wx].output:=p; w^[wx].crud:=true; myid;
  54.         w^[wx].node_type:=nt_display; next_state:=main_menu]
  55. {normal commands}
  56.      else if str.len=1 and then str[1]=mn[4][1] then {?}
  57.        display(main_menu_list_txt)
  58.      else if str.len=1 and then str[1]=mn[4][2] then {A}
  59.        [if q[wx].level>=priv_ans then
  60.           [display(answer_again_txt); next_state:=answer]
  61.         else
  62.           display(read_access_txt)]
  63.      else if str.len=1 and then str[1]=mn[4][3] {B} then
  64.        [if q[wx].level>=priv_br then
  65.           [q[wx].return_state:=main_menu;
  66.            display(browse_head_txt); next_state:=browse_prompt]
  67.         else
  68.           display(read_access_txt)]
  69.      else if str.len=1 and then str[1]=mn[4][4] then {C}
  70.        [display(lounge_header_txt); next_state:=chat_menu]
  71.      else if str.len=1 and then str[1]=mn[5][5] then {D}
  72.        [display(dbw_txt); next_state:=db1]
  73.      else if str.len=1 and then str[1]=mn[4][5] then {E}
  74.        [if fs_openr(wx,'EXPLAIN')=0 then
  75.           [q[wx].return_state:=main_menu; q[wx].bflag:=true;
  76.            next_state:=display_file]
  77.        else
  78.          [fs_close(wx); next_state:=main_menu]]
  79.      else if str.len=1 and then str[1]=mn[4][6] then {F}
  80.        display(facts_txt)
  81.      else if str.len=1 and then str[1]=mn[4][7] then {G}
  82.        [q[wx].flag:=true; {allow return to main menu}
  83.         next_state:=goodbye_menu]
  84.      else if str.len=1 and then str[1]=mn[4][8] then {L}
  85.        [display(libr_welcome_txt); next_state:=libr_menu]
  86.      else if str.len=1 and then str[1]=mn[4][9] {M} then
  87.        [if q[wx].level>=priv_ma then
  88.           [q[wx].return_state:=main_menu;
  89.            if business then
  90.              [q[wx].index:=1;
  91.               display(match_header_txt); next_state:=match_line]
  92.            else
  93.              [display(match_parameters_txt); next_state:=match]]
  94.         else
  95.           display(read_access_txt)]
  96.      else if str.len=1 and then str[1]=mn[4][10] then {N}
  97.        [if q[wx].level>=priv_bio then
  98.           [if essay<>nil then
  99.              [q[wx].return_state:=main_menu;
  100.               display(bio_header_txt); next_state:=bio]
  101.            else
  102.              next_state:=main_menu]
  103.         else
  104.           display(read_access_txt)]
  105.      else if str.len=1 and then str[1]=mn[5][6] then {O}
  106.        [if q[wx].level>=priv_order then
  107.           [if order<>nil then
  108.              [q[wx].return_state:=main_menu;
  109.               prompt_with(ordr_header_txt); next_state:=ordr]
  110.            else
  111.              next_state:=main_menu]
  112.         else
  113.           display(read_access_txt)]
  114.      else if str.len=1 and then str[1]=mn[4][11] then {P}
  115.        [if ivalue(q[wx].my.times_called)<many_calls
  116.           then [display(pubmail_header_txt); next_state:=pubmail1]
  117.           else [prompt_with(select_category_txt); next_state:=pubmail4]]
  118.      else if str.len=1 and then str[1]=mn[4][12] then {R}
  119.        [if q[wx].mbx_first=nil then
  120.           next_state:=msgs_4u
  121.         else
  122.           [q[wx].count:=ivalue(q[wx].my.mbx_count); q[wx].current_msg:=0;
  123.            display(msg_title_txt); next_state:=readmail_header]]
  124.      else if str.len=1 and then str[1]=mn[5][1] then {S}
  125.        [if q[wx].level>=priv_send then
  126.           [if q[wx].holding then
  127.              [if q[wx].hold_target=-1 then
  128.                 display(hold_error_txt)
  129.               else
  130.                 [q[wx].return_state:=main_menu;
  131.                  q[wx].correspondent:=q[wx].hold_target;
  132.                  display(send_menu_list_txt); next_state:=sendmail_menu]]
  133.            else
  134.              [q[wx].return_state:=main_menu; q[wx].flag:=true;
  135.               display(send_private_txt); next_state:=sendmail_prompt]]
  136.         else
  137.           display(read_access_txt)]
  138.      else if str.len=1 and then str[1]=mn[5][2] {U} then
  139.        [if q[wx].level>=priv_us then
  140.           [q[wx].index:=userlog_next; q[wx].count:=0;
  141.            display(userlog_head_txt); next_state:=userlog]
  142.         else
  143.           display(read_access_txt)]
  144.      else if str.len=1 and then str[1]=mn[5][3] then {W}
  145.        [q[wx].index:=number_of_lines; q[wx].return_state:=main_menu;
  146.         display(who_header_txt); next_state:=who]
  147.      else if str.len=1 and then str[1]=mn[5][4] {X}
  148.              and then q[wx].level>=priv_x then
  149.        [q[wx].cleanup:='X'; next_state:=cleanup1]
  150.      else if str.len>2 and then
  151.              str[1]=mn[7][2] {/} and then str[2]=mn[7][4] {P} then {/P}
  152.        SlashP(s,str)
  153.      else if eq(str,ss[40]) then {HELP}
  154.        [if fs_openr(wx,'HELP')=0 then
  155.           [q[wx].return_state:=main_menu; q[wx].bflag:=true;
  156.            next_state:=display_file]
  157.        else
  158.          [fs_close(wx); next_state:=main_menu]]
  159.      else if eq(str,ss[41]) then {NEWS}
  160.        [if fs_openr(wx,'NEWS')=0 then
  161.           [q[wx].return_state:=main_menu; q[wx].bflag:=true;
  162.            next_state:=display_file]
  163.         else
  164.           [fs_close(wx); next_state:=main_menu]]
  165.      else if eq(str,ss[42]) then {NOWRAP}
  166.        [w^[wx].wrapat:=79; setwrap(79)]
  167.      else if eq(str,ss[44]) then {NEWPASSWORD}
  168.        [prompt_with(enter_pw_txt); next_state:=newpass]
  169.      else if eq(str,ss[45]) or else eq(str,ss[46]) then {TIME, DATE}
  170.        display(date_time_txt)
  171.      else if eq(str,ss[47]) then {WRAP}
  172.        [w^[wx].wrapat:=wrap_column; setwrap(wrap_column)]
  173. {sysop commands}
  174.      else if q[wx].level=9 and then str[1]='!' then begin
  175.      if str='!C' and then (not q[wx].holding) then
  176.        [q[wx].return_state:=main_menu; q[wx].flag:=false; {canned msg}
  177.         display(send_private_txt); next_state:=sendmail_prompt]
  178.      else if str='!D' then
  179.        [q[wx].return_state:=main_menu;
  180.         prompt_with(delete_user_txt); next_state:=delete_user]
  181.      else if str='!J' then
  182.        [prompt_with(send_junkmail_txt); next_state:=junk1]
  183.      else if str='!K' then
  184.        [prompt_with(kill_line_txt); next_state:=kill_line]
  185.      else if str='!L' then
  186.        [q[wx].return_state:=main_menu;
  187.         prompt_with(change_level_txt); next_state:=change_level]
  188.      else if str='!M' then
  189.        [q[wx].return_state:=main_menu;
  190.         prompt_with(change_mbx_txt); next_state:=change_mbx]
  191.      else if str='!N' then
  192.        [if allow_new
  193.           then [allow_new:=false; display(nonew1s_txt)]
  194.           else [allow_new:=true; display(new1s_txt)]]
  195.      else if str='!O' then
  196.        [q[wx].return_state:=main_menu;
  197.         prompt_with(delete_old_txt); next_state:=delete_old]
  198.      else if str='!R' then
  199.        [prompt_with(recycle_txt); next_state:=recycle]
  200.      else if str='!T' then
  201.        [q[wx].return_state:=main_menu;
  202.         prompt_with(reset_time_txt); next_state:=reset_time]
  203.      else if str='!UA' then
  204.        [prompt_with(unanswer_txt); next_state:=unans1]
  205.      else if str='!UD' then
  206.        [prompt_with(undel_user_txt); next_state:=undel_user]